<#include "/layout/header.ftl"/>
<div class="clearfix"></div>
<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <ol class="breadcrumb">
            <li><a href="/">首页</a></li>
            <li class="active">资源管理</li>
        </ol>
        <div class="x_panel">
            <div class="x_content">
                <div class="<#--table-responsive-->">
                    <div class="btn-group hidden-xs" id="toolbar">
                        <@shiro.hasPermission name="examine">
                            <button id="btn_add" type="button" class="btn btn-default" title="新增资源">
                                <i class="fa fa-plus"></i> 新增资源
                            </button>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="examine">
                            <button id="btn_delete_ids" type="button" class="btn btn-default" title="删除选中">
                                <i class="fa fa-trash-o"></i> 批量删除
                            </button>
                        </@shiro.hasPermission>
                    </div>
                    <table id="tablelist">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<#include "/layout/footer.ftl"/>
<script>
    /**
     * 操作按钮
     * @param code
     * @param row
     * @param index
     * @returns {string}
     */
    function operateFormatter(code, row, index) {
        var trId = row.id;
        var operateBtn = [
            '<@shiro.hasPermission name="examine"><a class="btn btn-xs btn-primary btn-update" data-id="' + trId + '"><i class="fa fa-edit"></i>审核成功</a></@shiro.hasPermission>',
            '<@shiro.hasPermission name="examine"><a class="btn btn-xs btn-danger btn-remove" data-id="' + trId + '"><i class="fa fa-trash-o"></i>审核失败</a></@shiro.hasPermission>'
        ];
        return operateBtn.join('');
    }
    $(function () {
        var options = {
            url: "/userExamine/nolist",
            //getInfoUrl: "/resources/get/{id}",
            updateUrl: "/userExamine/examSuccess",
            removeUrl: "/userExamine/examFalut",
            //createUrl: "/talentshare/add",
            //saveRolesUrl: "/talentshare/save",
            columns: [{
                checkbox: false
            },
            // {
            //     field: 'name',
            //     title: '姓名',
            //     editable: true
            // },{
            //     field: 'gender',
            //     title: '性别',
            //     editable: true
            //     formatter: function (code) {
            //         return code == '1' ? '男' : '女';
            //     }
            // },
                {
                field: 'type',
                title: '认证类型',
                editable: true
            }, {
                field: 'image',
                title: '审核图片',
                editable: true,
            }, {
                field: 'description',
                title: '描述',
                editable: true,
            }, {
                field: '创建时间',
                title: 'creat_time',
                editable: false
            },{
                field: 'operate',
                title: '操作',
                formatter: operateFormatter //自定义方法，添加操作按钮
            }],
            modalName: "人才共享"
        }
        //1.初始化Table
        $.tableUtil.init(options);
        //2.初始化Button的点击事件
        $.buttonUtil.init(options);

    });
</script>